<script setup lang='ts'>
import { ref } from "vue";
import { useRouter } from "vue-router";
const router = useRouter()
const data = ref<{ title: string }[]>()
const { data: ClearData } = defineProps<{
    data: number | []
}>()
if (localStorage.getItem('searchData') !== null && localStorage.getItem('searchData') !== '') {
    data.value = JSON.parse(localStorage.getItem('searchData') as string)
}
const torouter = (e:string) => {
    router.push({name:'ThisSelect',query:{type:e}})
}
</script>

<template>
    <van-cell @click="torouter(i.title)" v-if="ClearData !== 0" v-for="(i, index) in data" :key="index" is-link :title="i.title" icon="clock-o">
        <!-- 使用 right-icon 插槽来自定义右侧图标 -->
        <template #right-icon>
            <van-icon name="search" clickable class="search-icon" />
        </template>
    </van-cell>
</template>

<style scoped>
.custom-title {
    margin-right: 4px;
    vertical-align: middle;
}

.search-icon {
    font-size: 16px;
    line-height: inherit;
}
</style>